﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using RN.ERP.BLL;
using RN.ERP.DTO;
using Newtonsoft.Json;
using Fly.Log;
using Fly.FlyCommon;
using Fly.Common.Linq;

using BllType = RN.ERP.BLL.BllType;
using RN.ERP.Entity.ResultModels;
using System.ServiceModel.Activation;

namespace RN.ERP
{
    // 注意: 使用“重构”菜单上的“重命名”命令，可以同时更改代码、svc 和配置文件中的类名“EnterpriseService”。
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    public partial class EnterpriseService : IEnterpriseService
    {
        //private BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, Utilities.GetDbType());
        //private BaseBasicBLL basicBll = (BaseBasicBLL)BllFactory.CreateBll(BllType.Basic, Utilities.GetDbType());

        #region
        public bool IsOrgnizationCodeExists(string orgnizationCode, string corpType, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return enterpriseBll.IsOrgnizationCodeExists(orgnizationCode, corpType, areaCode);
        }

        public string GetCorpChangeItems(string changeType, string areaCode)
        {
            string appId = "0";
            if (System.Configuration.ConfigurationManager.AppSettings["AppId"] != null)
            {
                appId = System.Configuration.ConfigurationManager.AppSettings["AppId"];
            }
            BaseBasicBLL basicBll = (BaseBasicBLL)BllFactory.CreateBll(BllType.Basic, areaCode);
            return basicBll.GetChangeItems(changeType, appId, areaCode);
        }

        public string GetCorpQualityItems(string corpType, string areaCode)
        {
            throw new NotImplementedException();
        }

        public string GetCorpInfo(string corpUserGuid, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return enterpriseBll.GetCorpInfo(corpUserGuid, areaCode);
        }

        public string GetCorpInfoWdrq(string corpUserGuid, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            List<tb_Corp_CompanyInfo_wdrq> list = enterpriseBll.GetCorpInfoWdrq(corpUserGuid, areaCode);
            return JsonConvert.SerializeObject(list);
        }

        public string GetCorpQualities(string corpUserGuid, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return enterpriseBll.GetCorpQualities(corpUserGuid, areaCode);
        }

        public string GetCorpQualitiesByConditon(string condition, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return JsonConvert.SerializeObject(enterpriseBll.GetCorpQualitiesByConditon(condition, areaCode));
        }

        public string GetCorpQuality(string qualityId, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return enterpriseBll.GetCorpQuality(qualityId, areaCode);
        }

        public string GetCorpInfos(string condition, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return enterpriseBll.GetCorpInfos(condition, areaCode);
        }

        public int GetCorpInfosCount(int pageIndex, int pageSize, string condition, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return enterpriseBll.GetCorpInfosCount(pageIndex, pageSize, condition, areaCode);

        }
        public string GetCorpChanges(string changetype, string corpUserGuid, string flowCode, string condition, int pageIndex, int pageSize, out int count, string areaCode)
        {
            BaseBasicBLL basicBll = (BaseBasicBLL)BllFactory.CreateBll(BllType.Basic, areaCode);
            return basicBll.GetChanges(changetype, corpUserGuid, flowCode, condition, pageIndex, pageSize, out count, areaCode);
        }

        public string GetCorpChangeDetails(int changeSetId, string areaCode)
        {
            BaseBasicBLL basicBll = (BaseBasicBLL)BllFactory.CreateBll(BllType.Basic, areaCode);
            return basicBll.GetChangeDetails("corp", changeSetId, areaCode);
        }

        public string AddCorpChange(string changeSetInfo, string changeInfo, string userGuid, string userRole, string userName, string areaCode)
        {
            BaseBasicBLL basicBll = (BaseBasicBLL)BllFactory.CreateBll(BllType.Basic, areaCode);
            return basicBll.AddChange(changeSetInfo, changeInfo, "corp", userGuid, userRole, userName, areaCode);
        }

        public string EditCorpChange(string changeSetInfo, string changeInfo, string userGuid, string userRole, string userName, string areaCode)
        {
            BaseBasicBLL basicBll = (BaseBasicBLL)BllFactory.CreateBll(BllType.Basic, areaCode);
            return basicBll.EditChange(changeSetInfo, changeInfo, "corp", userGuid, userRole, userName, areaCode);
        }

        public string DeleteCorpChange(string changeId, string userGuid, string userRole, string userName, string areaCode)
        {
            BaseBasicBLL basicBll = (BaseBasicBLL)BllFactory.CreateBll(BllType.Basic, areaCode);
            return basicBll.DeleteChange(changeId, "corp", userGuid, userRole, userName, areaCode);
        }

        public string SubmitCorpChange(string changeIds, string userGuid, string userRole, string userName, string areaCode)
        {
            BaseBasicBLL basicBll = (BaseBasicBLL)BllFactory.CreateBll(BllType.Basic, areaCode);
            return basicBll.SubmitChange(changeIds, "corp", userGuid, userRole, userName, areaCode);
        }

        public string AuditCorpChange(string changeId, string flowCode, string description, bool isFinal, string userGuid, string userRole, string userName, string areaCode)
        {
            BaseBasicBLL basicBll = (BaseBasicBLL)BllFactory.CreateBll(BllType.Basic, areaCode);
            return basicBll.AuditChange(changeId, flowCode, description, isFinal, "", userGuid, userRole, userName, areaCode);
        }

        public string GetBeforeChangeValue(string changeItem, string areaCode, string[] parameters)
        {
            BaseBasicBLL basicBll = (BaseBasicBLL)BllFactory.CreateBll(BllType.Basic, areaCode);
            return basicBll.GetBeforeChangeValue(changeItem, areaCode, parameters);
        }

        public string GetBindChangeValue(string changeItem, string areaCode, string[] parameters)
        {
            BaseBasicBLL basicBll = (BaseBasicBLL)BllFactory.CreateBll(BllType.Basic, areaCode);
            return basicBll.GetBindChangeValue(changeItem, areaCode, parameters);
        }

        public string GetCorpSecurity(string corpUserGuid, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return enterpriseBll.GetCorpSecurity(corpUserGuid, areaCode);
        }

        public string GetCorpSecurityList(string queryCondition, int pageSize, int pageNum, string areaCode, out int count)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            IList<DTO.Kh_CorpTable> corpQualityList = enterpriseBll.GetCorpSecurityList(queryCondition,pageSize,pageNum,areaCode,out count);
            return JsonConvert.SerializeObject(corpQualityList);
        }

        public string GetCorpKind(string corpkind, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return enterpriseBll.GetCorpKind(corpkind, areaCode);
        }

        public string GetQualityGrade(string dicquery, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return enterpriseBll.GetQualityGrade(dicquery, areaCode);
        }

        public string GetCorpQualityChanges(string corpUserGuid, string flowCode, string condition, int pageIndex, int pageSize, out int count, string areaCode)
        {
            BaseBasicBLL basicBll = (BaseBasicBLL)BllFactory.CreateBll(BllType.Basic, areaCode);
            return basicBll.GetChanges("corpquality", corpUserGuid, flowCode, condition, pageIndex, pageSize, out count, areaCode);
        }

        public string GetCorpQualityChangeDetails(int changeSetId, string areaCode)
        {
            BaseBasicBLL basicBll = (BaseBasicBLL)BllFactory.CreateBll(BllType.Basic, areaCode);
            return basicBll.GetChangeDetails("corpquality", changeSetId, areaCode);
        }

        public string AddCorpQualityChange(string changeSetInfo, string changeInfo, string userGuid, string userRole, string userName, string areaCode)
        {
            BaseBasicBLL basicBll = (BaseBasicBLL)BllFactory.CreateBll(BllType.Basic, areaCode);
            return basicBll.AddChange(changeSetInfo, changeInfo, "corpquality", userGuid, userRole, userName, areaCode);
        }

        public string EditCorpQualityChange(string changeSetInfo, string changeInfo, string userGuid, string userRole, string userName, string areaCode)
        {
            BaseBasicBLL basicBll = (BaseBasicBLL)BllFactory.CreateBll(BllType.Basic, areaCode);
            return basicBll.EditChange(changeSetInfo, changeInfo, "corpquality", userGuid, userRole, userName, areaCode);
        }

        public string DeleteCorpQualityChange(string changeId, string userGuid, string userRole, string userName, string areaCode)
        {
            BaseBasicBLL basicBll = (BaseBasicBLL)BllFactory.CreateBll(BllType.Basic, areaCode);
            return basicBll.DeleteChange(changeId, "corpquality", userGuid, userRole, userName, areaCode);
        }

        public string SubmitCorpQualityChange(string changeIds, string userGuid, string userRole, string userName, string areaCode)
        {
            BaseBasicBLL basicBll = (BaseBasicBLL)BllFactory.CreateBll(BllType.Basic, areaCode);
            return basicBll.SubmitChange(changeIds, "corpquality", userGuid, userRole, userName, areaCode);
        }

        public string AuditCorpQualityChange(string changeId, string flowCode, bool isFinal, string userGuid, string userRole, string userName, string areaCode)
        {
            throw new NotImplementedException();
        }

        public string GetCorpSafeChanges(string corpUserGuid, string flowCode, string condition, int pageIndex, int pageSize, out int count, string areaCode)
        {
            BaseBasicBLL basicBll = (BaseBasicBLL)BllFactory.CreateBll(BllType.Basic, areaCode);
            return basicBll.GetChanges("safe", corpUserGuid, flowCode, condition, pageIndex, pageSize, out count, areaCode);
        }

        public string GetCorpSafeChangeDetails(int changeSetId, string areaCode)
        {
            BaseBasicBLL basicBll = (BaseBasicBLL)BllFactory.CreateBll(BllType.Basic, areaCode);
            return basicBll.GetChangeDetails("safe", changeSetId, areaCode);
        }

        public string AddCorpSafeChange(string changeSetInfo, string changeInfo, string userGuid, string userRole, string userName, string areaCode)
        {
            BaseBasicBLL basicBll = (BaseBasicBLL)BllFactory.CreateBll(BllType.Basic, areaCode);
            return basicBll.AddChange(changeSetInfo, changeInfo, "safe", userGuid, userRole, userName, areaCode);
        }

        public string EditCorpSafeChange(string changeSetInfo, string changeInfo, string userGuid, string userRole, string userName, string areaCode)
        {
            BaseBasicBLL basicBll = (BaseBasicBLL)BllFactory.CreateBll(BllType.Basic, areaCode);
            return basicBll.EditChange(changeSetInfo, changeInfo, "safe", userGuid, userRole, userName, areaCode);
        }

        public string DeleteCorpSafeChange(string changeId, string userGuid, string userRole, string userName, string areaCode)
        {
            BaseBasicBLL basicBll = (BaseBasicBLL)BllFactory.CreateBll(BllType.Basic, areaCode);
            return basicBll.DeleteChange(changeId, "safe", userGuid, userRole, userName, areaCode);
        }

        public string SubmitCorpSafeChange(string changeIds, string userGuid, string userRole, string userName, string areaCode)
        {
            BaseBasicBLL basicBll = (BaseBasicBLL)BllFactory.CreateBll(BllType.Basic, areaCode);
            return basicBll.SubmitChange(changeIds, "safe", userGuid, userRole, userName, areaCode);
        }

        public string AuditCorpSafeChange(string changeId, string flowCode, string description, bool isFinal, string userGuid, string userRole, string userName, string areaCode)
        {
            BaseBasicBLL basicBll = (BaseBasicBLL)BllFactory.CreateBll(BllType.Basic, areaCode);
            return basicBll.AuditChange(changeId, flowCode, description, isFinal, "", userGuid, userRole, userName, areaCode);

        }

        public string GetChangeDetails(string changeType, int changeSetId, string areaCode)
        {
            BaseBasicBLL basicBll = (BaseBasicBLL)BllFactory.CreateBll(BllType.Basic, areaCode);
            return basicBll.GetChangeDetails(changeType, changeSetId, areaCode);
        }

        public string GetCorpOuterPrizeCount(string condition, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return enterpriseBll.GetCorpOuterPrizeCount(condition, areaCode);
        }

        public string GetCorpOuterPrize(string condition, int pageIndex, int pageSize, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return enterpriseBll.GetCorpOuterPrize(condition, pageIndex, pageSize, areaCode);
        }

        /// <summary>
        /// 企业工程类获奖
        /// </summary>
        /// <param name="condition"></param>
        /// <returns></returns>
        public string GetCorpProjectPrizePunish(string condition, int pageIndex, int pageSize, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return enterpriseBll.GetCorpProjectPrizePunish(condition, pageIndex, pageSize, areaCode);
        }

        public string GetCorpProjectPrizePunishCount(string condition, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return enterpriseBll.GetCorpProjectPrizePunishCount(condition, areaCode);
        }

        /// <summary>
        /// 非工程类获奖
        /// </summary>
        /// <param name="condition"></param>
        /// <returns></returns>
        public string GetCorpPrizePunish(string condition, int pageIndex, int pageSize, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return enterpriseBll.GetCorpPrizePunish(condition, pageIndex, pageSize, areaCode);
        }

        public string GetCorpPrizePunishCount(string condition, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return enterpriseBll.GetCorpPrizePunishCount(condition, areaCode);
        }

        /// <summary>
        /// 本市、外埠市场[招标代理] 工程详细信息
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        public string GetOuterPrizeProjectInfoByID(string ID, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return enterpriseBll.GetOuterPrizeProjectInfoByID(ID, areaCode);
        }

        /// <summary>
        /// 查询e_FlowTable的历史记录
        /// </summary>
        /// <returns></returns>
        public string GetAuditHistory(string condition, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return enterpriseBll.GetAuditHistory(condition, areaCode);
        }

        /// <summary>
        /// 查询该企业下的所有工程业绩
        /// </summary>
        /// <param name="condition"></param>
        /// <returns></returns>
        public string GetCorpOuerPrizeAllProjectByCorpGuid(string condition, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return enterpriseBll.GetCorpOuerPrizeAllProjectByCorpGuid(condition, areaCode);
        }

        public string GetProjectPrizePunishInfoByID(string ID, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return enterpriseBll.GetProjectPrizePunishInfoByID(ID, areaCode);
        }

        public string GEtCheckTitleByKHID(string KHID, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return enterpriseBll.GEtCheckTitleByKHID(KHID, areaCode);
        }

        public string GetProjectPrizePunishByCorpGuid(string condition, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return enterpriseBll.GetProjectPrizePunishByCorpGuid(condition, areaCode);
        }

        public string GetPrizePunishInfoByID(string ID, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return enterpriseBll.GetPrizePunishInfoByID(ID, areaCode);
        }

        public string GetPrizePunishByCorpGuid(string condition, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return enterpriseBll.GetPrizePunishByCorpGuid(condition, areaCode);
        }
        #endregion

        #region 企业端、主管端企业资质:注册添加、修改、查询、上报、审核 作者：
        /// <summary>
        /// 企业端:企业注册
        /// </summary>
        /// <param name="corpInfo"></param>
        /// <param name="userInfo"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        public string CorpRegister(string corpInfo, string userInfo, bool isReturnModel, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            RN.ERP.DTO.Tb_Corp_CompanyInfo corpInfoModel = JsonConvert.DeserializeObject<Tb_Corp_CompanyInfo>(corpInfo);
            T_Sys_Users userInfoModel = JsonConvert.DeserializeObject<T_Sys_Users>(userInfo);
            RN.ERP.DTO.OperationResult result = enterpriseBll.CorpRegister(corpInfoModel, userInfoModel, isReturnModel, areaCode);
            return JsonConvert.SerializeObject(result);
        }
        /// <summary>
        /// 聊城批量导入企业信息,并生成用户信息
        /// </summary>
        /// <param name="corps"></param>
        /// <param name="areacode"></param>
        /// <returns></returns>
        public string BatchImportCorpUser(string corps, string areacode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areacode);
            List<ImportCompanyInfo> list = JsonConvert.DeserializeObject<List<ImportCompanyInfo>>(corps);
            var result = enterpriseBll.BatchImportCorpUser(list, areacode);
            return JsonConvert.SerializeObject(result);
        }

        /// <summary>
        /// 企业端:企业注册信息上报（含企业内人员及资质）
        /// </summary>
        /// <param name="corpUserGuid"></param>
        /// <param name="isPostEmp"></param>
        /// <param name="isPostQuality"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        public string CorpPost(string corpUserGuid, bool isPostEmp, bool isPostQuality, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            RN.ERP.DTO.OperationResult result = enterpriseBll.CorpPost(corpUserGuid, isPostEmp, isPostQuality, areaCode);
            return JsonConvert.SerializeObject(result);
        }

        /// <summary>
        /// 安全生产许可证信息上报
        /// </summary>
        /// <param name="corpUserGuid"></param>
        /// <param name="isPostEmp"></param>
        /// <param name="isPostQuality"></param>
        /// <param name="areaCode"></param>
        /// <returns></returns>
        public string KH_CorpPost(string corpUserGuid, bool isPostEmp, bool isPostQuality, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            RN.ERP.DTO.OperationResult result = enterpriseBll.KH_CorpPost(corpUserGuid, isPostEmp, isPostQuality, areaCode);
            return JsonConvert.SerializeObject(result);
        }

        public string CorpCancelPost(string corpUserGuid, string cancelReason, string areacode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areacode);
            RN.ERP.DTO.OperationResult result = enterpriseBll.CorpCancelPost(corpUserGuid, cancelReason, areacode);
            return JsonConvert.SerializeObject(result);
        }

        public string GetCorpostStatus(Guid corpuserguid, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return enterpriseBll.GetCorpostStatus(corpuserguid, areaCode);
        }
        /// <summary>
        /// 企业端:企业基本信息变更
        /// </summary>
        /// <param name="corpInfo"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        public string CorpInfoEdit(string corpInfo, string khCorpTable, string wdrq, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            RN.ERP.DTO.Tb_Corp_CompanyInfo corpInfoModel = JsonConvert.DeserializeObject<Tb_Corp_CompanyInfo>(corpInfo);
            Kh_CorpTable khCorpTableModel = JsonConvert.DeserializeObject<Kh_CorpTable>(khCorpTable);
            tb_Corp_CompanyInfo_wdrq wdrqModel = JsonConvert.DeserializeObject<tb_Corp_CompanyInfo_wdrq>(wdrq);
            RN.ERP.DTO.OperationResult result = enterpriseBll.CorpInfoEdit(corpInfoModel, khCorpTableModel, wdrqModel, areaCode);
            return JsonConvert.SerializeObject(result);
        }

        /// <summary>
        /// 企业端:企业添加资质
        /// </summary>
        /// <param name="corpUserGuid"></param>
        /// <param name="qualities"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        public string CorpQualityAdd(string corpUserGuid, string qualities, bool isReturnModel, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            IList<tb_Corp_Quality> corpQuelityList = JsonConvert.DeserializeObject<IList<tb_Corp_Quality>>(qualities);
            RN.ERP.DTO.OperationResult result = enterpriseBll.CorpQualityAdd(corpUserGuid, corpQuelityList, isReturnModel, areaCode);
            return JsonConvert.SerializeObject(result);
        }

        /// <summary>
        /// 修改企业资质
        /// </summary>
        /// <param name="quality"></param>
        /// <returns></returns>
        public string CorpQualityEdit(string quality, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            tb_Corp_Quality corpQualityModel = JsonConvert.DeserializeObject<tb_Corp_Quality>(quality);
            RN.ERP.DTO.OperationResult result = enterpriseBll.CorpQualityEdit(corpQualityModel, areaCode);
            return JsonConvert.SerializeObject(result);
        }

        /// <summary>
        /// 删除企业资质
        /// </summary>
        /// <param name="qualityGuid"></param>
        /// <returns></returns>
        public string CorpQualityDel(string qualityGuid, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            RN.ERP.DTO.OperationResult result = enterpriseBll.CorpQualityDel(qualityGuid, areaCode);
            return JsonConvert.SerializeObject(result);
        }

        /// <summary>
        /// 企业端:企业资质上报
        /// </summary>
        /// <param name="qualityGuid"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        public string CorpQualityPost(IList<string> qualityGuid, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            RN.ERP.DTO.OperationResult result = enterpriseBll.CorpQualityPost(qualityGuid, areaCode);
            return JsonConvert.SerializeObject(result);
        }

        /// <summary>
        /// 主管端:主管审核企业上报的注册信息(多个)
        /// </summary>
        /// <param name="corpUserGuids"></param>
        /// <param name="log"></param>
        /// <param name="flowCode"></param>
        /// <returns></returns>
        public string CorpListAudit(IList<string> corpUserGuids, string log, string flowCode, bool isunlockandback, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            User_Log logModel = JsonConvert.DeserializeObject<User_Log>(log);
            RN.ERP.DTO.OperationResult result = enterpriseBll.CorpListAudit(corpUserGuids, logModel, flowCode, isunlockandback, areaCode);
            return JsonConvert.SerializeObject(result);
        }

        /// <summary>
        /// 主管端:主管审核企业上报的注册信息
        /// </summary>
        /// <param name="corpUserGuid"></param>
        /// <param name="areaCode"></param>
        /// <param name="log"></param>
        /// <param name="flowCode"></param>
        /// <param name="isFinal"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        public string CorpAudit(string corpUserGuid, string areaCode, string log, string flowCode, string description, bool isFinal)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            User_Log logModel = JsonConvert.DeserializeObject<User_Log>(log);
            RN.ERP.DTO.OperationResult result = enterpriseBll.CorpAudit(corpUserGuid, areaCode, logModel, flowCode, description, isFinal);
            return JsonConvert.SerializeObject(result);
        }

        /// <summary>
        /// 主管端:主管审核企业上报的安全生产许可证信息
        /// </summary>
        /// <param name="corpUserGuid"></param>
        /// <param name="areaCode"></param>
        /// <param name="log"></param>
        /// <param name="flowCode"></param>
        /// <param name="description"></param>
        /// <param name="isFinal"></param>
        /// <returns></returns>
        public string CorpSafeAudit(string corpUserGuid, string areaCode, string log, string flowCode, string description, bool isFinal)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            User_Log logModel = JsonConvert.DeserializeObject<User_Log>(log);
            RN.ERP.DTO.OperationResult result = enterpriseBll.CorpSafeAudit(corpUserGuid, areaCode, logModel, flowCode, description, isFinal);
            return JsonConvert.SerializeObject(result);
        }

        /// <summary>
        /// 主管端:主管审核企业的资质
        /// </summary>
        /// <param name="corpUserGuid"></param>
        /// <param name="areaCode"></param>
        /// <param name="log"></param>
        /// <param name="flowCode"></param>
        /// <param name="isFinal"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        public string CorpQualityAudit(string corpUserGuid, string areaCode, string log, string flowCode, bool isFinal)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            User_Log logModel = JsonConvert.DeserializeObject<User_Log>(log);
            RN.ERP.DTO.OperationResult result = enterpriseBll.CorpQualityAudit(corpUserGuid, areaCode, logModel, flowCode, isFinal);
            return JsonConvert.SerializeObject(result);
        }

        /// <summary>
        /// 主管端:主管审核企业的资质
        /// </summary>
        /// <param name="qualities"></param>
        /// <param name="areaCode"></param>
        /// <param name="log"></param>
        /// <param name="flowCode"></param>
        /// <param name="isFinal"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        public string CorpQualityAuditByQualities(IList<string> qualities, string areaCode, string log, string flowCode, bool isFinal)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            User_Log logModel = JsonConvert.DeserializeObject<User_Log>(log);
            RN.ERP.DTO.OperationResult result = enterpriseBll.CorpQualityAuditByQualities(qualities, areaCode, logModel, flowCode, isFinal);
            return JsonConvert.SerializeObject(result);
        }

        /// <summary>
        /// 公共:查询企业信息列表
        /// </summary>
        /// <param name="pageCount"></param>
        /// <param name="pageSize"></param>
        /// <param name="conditions"></param>
        /// <returns></returns>
        public string GetCompaniesInfo(string conditions, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            IList<RN.ERP.DTO.Tb_Corp_CompanyInfo> corpInfoList = enterpriseBll.GetCompaniesInfo(conditions, areaCode);
            return JsonConvert.SerializeObject(corpInfoList);
        }

        /// <summary>
        /// 公共:查询企业详细信息
        /// </summary>
        /// <param name="conditions"></param>
        /// <returns></returns>
        public string GetCompanyInfo(string conditions, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            RN.ERP.DTO.Tb_Corp_CompanyInfo corpInfo = enterpriseBll.GetCompanyInfo(conditions, areaCode);
            return JsonConvert.SerializeObject(corpInfo);
        }
        public string GetCompanyAllInfo(
           string queryCondition,
           int pageSize,
           int pageNum,
           string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            IList<DTO.QueryCompanyInfoCondition> corpQuelityList = JsonConvert.DeserializeObject<IList<DTO.QueryCompanyInfoCondition>>(queryCondition);
            IList<DTO.CompanyInfo> result = enterpriseBll.GetCompanyInfo(corpQuelityList, pageSize, pageNum, areaCode);
            return JsonConvert.SerializeObject(result);
        }

        public int GetCompanyCount(string queryCondition, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            IList<DTO.QueryCompanyInfoCondition> corpQueryList = JsonConvert.DeserializeObject<IList<DTO.QueryCompanyInfoCondition>>(queryCondition);
            int cnt = enterpriseBll.GetCompanyCount(corpQueryList, areaCode);
            return cnt;
        }
        /// <summary>
        /// 公共:查询企业资质
        /// </summary>
        /// <param name="corpUserGuid"></param>
        /// <param name="conditions"></param>
        /// <returns></returns>
        public string GetCompanyQualities(string corpUserGuid, string conditions, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            IList<tb_Corp_Quality> corpQualityList = enterpriseBll.GetCompanyQualities(corpUserGuid, conditions, areaCode);
            return JsonConvert.SerializeObject(corpQualityList);
        }


        public string GetCompanyQualities1(string corpUserGuid, string conditions, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            IList<tb_Corp_Quality> corpQualityList = enterpriseBll.GetCompanyQualities1(corpUserGuid, conditions, areaCode);
            return JsonConvert.SerializeObject(corpQualityList);
        }

        public string GetCorpQualityAllInfo(
         string queryCondition,
         int pageSize,
         int pageNum,
         string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            IList<DTO.QueryCorpQualityInfoCondition> corpQuelityList = JsonConvert.DeserializeObject<IList<DTO.QueryCorpQualityInfoCondition>>(queryCondition);
            IList<DTO.CorpQuality> result = enterpriseBll.GetCorpQualityInfo(corpQuelityList, pageSize, pageNum, areaCode);
            return JsonConvert.SerializeObject(result);
        }
        /// <summary>
        /// 公共:获取企业的类型
        /// </summary>
        /// <returns></returns>
        public string GetCompanyType(string areaCode)
        {
            BaseBasicBLL basicBll = (BaseBasicBLL)BllFactory.CreateBll(BllType.Basic, areaCode);
            string dictString = basicBll.GetDictionary("corptype", "", areaCode);
            return dictString;
        }

        /// <summary>
        /// 公共:查询操作日志记录
        /// </summary>
        /// <param name="appId"></param>
        /// <param name="functionId"></param>
        /// <param name="functionType"></param>
        /// <param name="objectId"></param>
        /// <param name="isrtUser"></param>
        /// <param name="startDate"></param>
        /// <param name="endDate"></param>
        /// <returns></returns>
        public string GetUserLog(string objectId, string codeType, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            IList<User_Log> userLogList = enterpriseBll.GetUserLog(objectId, codeType, areaCode);
            return JsonConvert.SerializeObject(userLogList);
        }

        /// <summary>
        /// 公共:根据企业组织机构代码查询企业占用情况
        /// CorpRegisterValidationModel类包含bool的是否已注册，如果已经注册则包含Tb_Corp_CompanyInfo信息，和string的说明信息。
        /// </summary>
        /// <param name="corpCode"></param>
        /// <returns></returns>
        public string CorpRegisterValidate(string corpCode, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            DTO.CorpRegisterValidationModel corpRegVmodel = enterpriseBll.CorpRegisterValidate(corpCode, areaCode);
            return JsonConvert.SerializeObject(corpRegVmodel);
        }

        /// <summary>
        /// 查询企业审核信息列表
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="condition"></param>
        /// <returns></returns>
        public string GetFlowCorpInfos(int pageIndex, int pageSize, string condition, out int counts, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            IList<Tb_Corp_CompanyInfo1> flowList = enterpriseBll.GetFlowCorpInfos(pageIndex, pageSize, condition, out counts, areaCode);////Tb_Corp_CompanyInfo1
            return JsonConvert.SerializeObject(flowList);
        }

        public string GetFlowCorpInfosSystem2(int pageIndex, int pageSize, string condition, out int counts, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            IList<RN.ERP.DTO.Tb_Corp_CompanyInfo> flowList = enterpriseBll.GetFlowCorpInfosSystem2(pageIndex, pageSize, condition, out counts, areaCode);////Tb_Corp_CompanyInfo1
            return JsonConvert.SerializeObject(flowList);
        }

        public string CorpInfoWDRQEdit(string corpUserGuid, string wdrq, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            tb_Corp_CompanyInfo_wdrq wdrqModel = JsonConvert.DeserializeObject<tb_Corp_CompanyInfo_wdrq>(wdrq);
            RN.ERP.DTO.OperationResult result = enterpriseBll.CorpInfoWDRQEdit(corpUserGuid, wdrqModel, areaCode);
            return JsonConvert.SerializeObject(result);
        }

        /// <summary>
        /// 验证企业是否存清出市场
        /// </summary>
        /// <param name="dogId"></param>
        /// <returns></returns>
        public string CheckCorp(string dogId, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return enterpriseBll.CheckCorp(dogId, areaCode);

        }

        public string CheckCorpByCorpGuid(string corpGuid, string areaCode)
        {
            BaseEnterpriseBLL Bll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return Bll.CheckCorpByCorpGuid(corpGuid, areaCode);
        }
        #endregion

        #region 企业解锁、加锁 作者：
        public bool LockCorpBCanBid(string corpGuid, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return enterpriseBll.LockCorpBCanBid(corpGuid, areaCode);
        }
        public bool UnLockCorpBCanBid(string corpGuid, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return enterpriseBll.UnLockCorpBCanBid(corpGuid, areaCode);
        }
        #endregion

        #region 企业产量、产值、税金相关

        /// <summary>
        /// 根据年份查询企业是否有产量、产值、税金信息
        /// </summary>
        /// <param name="userGUID">企业GUID</param>
        /// <param name="year">年份</param>
        /// <param name="month">月份</param>
        /// <returns></returns>
        public bool ExistsProfix(string userGUID, int year, int month, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            bool result = false;
            result = enterpriseBll.ExistsProfix(userGUID, year, month, areaCode);
            return result;
        }

        /// <summary>
        /// 企业端获取企业产值、税金信息
        /// </summary>
        /// <param name="userGUID">企业GUID</param>
        /// <param name="year">年份</param>
        /// <param name="month">月份</param>
        /// <param name="flowCode">审核状态</param>
        /// <returns></returns>
        public string GetListByYearUserGUID(string userGUID, int year, int month, string flowCode, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return JsonConvert.SerializeObject(enterpriseBll.GetListByYearUserGUID(userGUID, year, month, flowCode, areaCode));
        }

        /// <summary>
        /// 添加企业产值、税金信息
        /// </summary>
        /// <param name="DTOProfit">序列化DTO实体</param>
        /// <returns></returns>
        public string AddProfit(string DTOProfit, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return JsonConvert.SerializeObject(enterpriseBll.AddProfit(JsonConvert.DeserializeObject<Tb_Corp_ProfitTotal>(DTOProfit), areaCode));
        }

        /// <summary>
        /// 根据ID获取企业产值、税金信息
        /// </summary>
        /// <param name="profitID">产值、税金ID</param>
        /// <returns></returns>
        public string GetProfitByID(int profitID, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            Tb_Corp_ProfitTotal profit = enterpriseBll.GetProfitByID(profitID, areaCode);
            return JsonConvert.SerializeObject(profit);
        }

        /// <summary>
        /// 根据ID(多个)删除企业产值、税金信息
        /// </summary>
        /// <param name="profitID">产值、税金ID</param>
        /// <returns>>返回序列化DTO.OperationResult结果</returns>
        public string DeleteProfitByIDS(string profitID, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return JsonConvert.SerializeObject(enterpriseBll.DeleteProfitByIDS(profitID, areaCode));
        }

        /// <summary>
        /// 修改企业产值、税金信息
        /// </summary>
        /// <param name="DTOprofit">序列化DTO实体</param>
        /// <returns>>返回序列化DTO.OperationResult结果</returns>
        public string UpdateProfitByID(string DTOprofit, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return JsonConvert.SerializeObject(enterpriseBll.UpdateProfitByID(JsonConvert.DeserializeObject<Tb_Corp_ProfitTotal>(DTOprofit), areaCode));
        }

        /// <summary>
        /// 企业上报税金数据
        /// </summary>
        /// <param name="profitID">产值、税金ID</param>
        /// <returns>>返回序列化DTO.OperationResult结果</returns>
        public string SBProfitByIDS(string profitID, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return JsonConvert.SerializeObject(enterpriseBll.SBProfitByIDS(profitID, areaCode));
        }

        /// <summary>
        /// 主管审核企业产值、税金信息
        /// </summary>
        /// <param name="profitID">产值、税金ID</param>
        /// <param name="type">1：审核，2：退回</param>
        /// <param name="checkMemo">审核意见</param>
        /// <returns>>返回序列化DTO.OperationResult结果</returns>
        public string CheckProfitByIDS(string profitID, int type, string checkMemo, bool isunlockandback, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return JsonConvert.SerializeObject(enterpriseBll.CheckProfitByIDS(profitID, type, checkMemo, isunlockandback, areaCode));
        }

        /// <summary>
        /// 主管端获取企业产值、税金信息
        /// </summary>
        /// <param name="corpName">企业名称</param>
        /// <param name="year">年份</param>
        /// <param name="month">月份</param>
        /// <param name="flowCode">审核状态</param>
        /// <returns></returns>
        public string GetProfitListForManager(string corpUserGuid, string corpName, int year, int month, string flowCode, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return JsonConvert.SerializeObject(enterpriseBll.GetProfitListForManager(corpUserGuid, corpName, year, month, flowCode, areaCode));
        }

        public string GetProfitGuidListForManager(string corpName, int year, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return JsonConvert.SerializeObject(enterpriseBll.GetProfitGuidListForManager(corpName, year, areaCode));
        }

        /// <summary>
        /// 同时添加一个企业某一年的产量，产值，税金记录
        /// </summary>
        /// <param name="year">年</param>
        /// <param name="userGUID">userGUID</param>
        /// <param name="dogID">dogID</param>
        /// <param name="corpName">企业名称</param>
        /// <returns></returns>
        public bool AddList(string year, string userGUID, string dogID, string corpName, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            bool result = false;
            result = enterpriseBll.AddList(year, userGUID, dogID, corpName, areaCode);
            return result;
        }

        /// <summary>
        /// 批量更新
        /// </summary>
        /// <param name="list">集合</param>
        /// <returns></returns>
        public bool UpdateInfoTotalList(string list, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            bool result = false;
            List<Tb_Corp_ProfitTotal> list_New = JsonConvert.DeserializeObject<List<Tb_Corp_ProfitTotal>>(list);
            result = enterpriseBll.UpdateInfoTotalList(list_New, areaCode);
            return result;
        }

        /// <summary>
        /// 主管查询企业的产量，产值，税金信息(JSON格式)
        /// </summary>
        /// <param name="year">年份</param>
        /// <param name="corpName">企业名称</param>
        /// <param name="areaCode">地区</param>
        /// <param name="flowState">审核状态：已审核、未审核</param>
        /// <returns></returns>
        public string GetListForManager(string year, string corpName, string areaCode, string flowState)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return JsonConvert.SerializeObject(enterpriseBll.GetListForManager(year, corpName, areaCode, flowState));
        }
        /// <summary>
        /// 主管批量审核
        /// </summary>
        /// <param name="list">由userGUID、年份组成的键值对集合</param>
        /// <param name="type">用户执行的操作：1代表审核，2代表退回，3代表弃审</param>
        /// <returns></returns>
        public bool CheckProfit(List<string> list, int type, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            bool result = false;
            result = enterpriseBll.CheckProfit(list, type, areaCode);
            return result;
        }

        #endregion

        #region 工程业绩列表

        /// <summary>
        /// 主管端获取工程业绩列表
        /// </summary>
        /// <param name="corpName">企业名称</param>
        /// <param name="projectName">工程名称</param>
        /// <param name="flowCode">审核状态</param>
        /// <returns></returns>
        public string GetProjectYJListForManager(string corpName, string projectName, string flowCode, string areaCode)
        {
            return "";
        }

        /// <summary>
        /// 企业端获取工程业绩列表
        /// </summary>
        /// <param name="corpUserGUID">企业名称GUID</param>
        /// <param name="year">年份</param>
        /// <param name="month">月份</param>
        /// <param name="flowCode">审核状态</param>
        /// <returns></returns>
        public string GetProjectYJListForCorp(string corpUserGUID, string projectName, string flowCode, string areaCode)
        {
            return "";
        }

        /// <summary>
        /// 企业端删除工程
        /// </summary>
        /// <param name="ID">工程ID</param>
        /// <returns></returns>
        public string DelProjectYJByIDS(string ID, string areaCode)
        {
            return "";
        }

        #endregion

        #region 业绩申报：添加，修改，审核，上报

        /// <summary>
        /// 业绩资质
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public string GetQualityByOuterPrizeID(string id, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return enterpriseBll.GetQualityByOuterPrizeID(id, areaCode);
        }

        public string CodeZjjg_bind(string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return enterpriseBll.CodeZjjg_bind(areaCode);
        }
        public string BindStructKind(string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return enterpriseBll.BindStructKind(areaCode);
        }

        #endregion
        #region 企业注册
        /// <summary>
        /// 判断用户名是否存在
        /// </summary>
        /// <param name="userName"></param>
        /// <returns></returns>
        public bool IsUserExisted(string userName, string areacode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areacode);
            return enterpriseBll.IsUserExisted(userName);
        }

        public string CorpReg(string corp, string user, string areacode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areacode);
            DTO.Tb_Corp_CompanyInfo corpModel = JsonConvert.DeserializeObject<Tb_Corp_CompanyInfo>(corp);
            DTO.T_Sys_Users userModel = JsonConvert.DeserializeObject<T_Sys_Users>(user);
            var result = enterpriseBll.CorpReg(corpModel, userModel);
            return JsonConvert.SerializeObject(result);
        }
        #endregion

        #region 企业信息修改(全省通用方法)
        /// <summary>
        /// 企业信息修改
        /// </summary>
        /// <param name="corpInfo">企业信息</param>
        /// <param name="khCorpTable">安全生产许可证信息</param>
        /// <param name="embranchMent">分支机构信息</param>
        /// <param name="areaCode">市场范围地区</param>
        /// <returns></returns>
        public string CorpEdit(string corpInfo, string khCorpTable, string embranchMent, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            Tb_Corp_CompanyInfo corpInfoModel = JsonConvert.DeserializeObject<Tb_Corp_CompanyInfo>(corpInfo);
            Kh_CorpTable khCorpTableModel = JsonConvert.DeserializeObject<Kh_CorpTable>(khCorpTable);
            Tb_Corp_Embranchment embranchMentModel = JsonConvert.DeserializeObject<Tb_Corp_Embranchment>(embranchMent);
            RN.ERP.DTO.OperationResult result = enterpriseBll.CorpEdit(corpInfoModel, khCorpTableModel, embranchMentModel, areaCode);
            return JsonConvert.SerializeObject(result);
        }

        public string KH_CorpEdit(string khCorpTable, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            Kh_CorpTable khCorpTableModel = JsonConvert.DeserializeObject<Kh_CorpTable>(khCorpTable);
            RN.ERP.DTO.OperationResult result = enterpriseBll.KH_CorpEdit(khCorpTableModel, areaCode);
            return JsonConvert.SerializeObject(result);
        }
        #endregion

        #region 获取所有市场范围
        public string GetCorpEmbranchments(string corpInfo)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, "");
            Tb_Corp_CompanyInfo corpInfoModel = JsonConvert.DeserializeObject<Tb_Corp_CompanyInfo>(corpInfo);
            var result = enterpriseBll.GetCorpEmbranchments(corpInfoModel);
            return JsonConvert.SerializeObject(result);

        }
        #endregion

        #region 获取当前市场范围是否审核通过
        public string GetCorpFlowCode(string corpInfo, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, "");
            Tb_Corp_CompanyInfo corpInfoModel = JsonConvert.DeserializeObject<Tb_Corp_CompanyInfo>(corpInfo);
            var result = enterpriseBll.GetCorpFlowCode(corpInfoModel, areaCode);
            return JsonConvert.SerializeObject(result);
        }
        #endregion

        public int GetCorpQualityCount(string queryCondition, string areaCondition)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCondition);
            IList<DTO.QueryCorpQualityInfoCondition> corpQuelityList = JsonConvert.DeserializeObject<IList<DTO.QueryCorpQualityInfoCondition>>(queryCondition);
            var result = enterpriseBll.GetCorpQualityCount(corpQuelityList, areaCondition);
            return result;
        }

        public string CorpAuditBack(string corpUserGuid, string areaCode, string log)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            User_Log userLog = JsonConvert.DeserializeObject<User_Log>(log);
            return JsonConvert.SerializeObject(enterpriseBll.CorpAuditBack(corpUserGuid, areaCode, userLog));
        }

        public string GetCompanyBisicInfo(string queryCondition, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            List<QueryCompanyInfoCondition> condition = JsonConvert.DeserializeObject<List<QueryCompanyInfoCondition>>(queryCondition);
            return JsonConvert.SerializeObject(enterpriseBll.GetCompanyBisicInfo(condition, areaCode));
        }

        public string EmbranchAdd(string corpUserGuid, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return JsonConvert.SerializeObject(enterpriseBll.EmbranchAdd(corpUserGuid, areaCode));
        }

        #region 获取企业资质图片
        public string GetCorpZZImages(string queryCondition, string areaCode)
        {
            List<QueryCorpQualityInfoCondition> condition = JsonConvert.DeserializeObject<List<QueryCorpQualityInfoCondition>>(queryCondition);
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return JsonConvert.SerializeObject(enterpriseBll.GetCorpZZImages(condition, areaCode));
        }
        #endregion

        #region 企业统计
        public string GetStatisticCorps(string areaCode, string flowCodes)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return JsonConvert.SerializeObject(enterpriseBll.GetStatisticCorps(areaCode, flowCodes));
        }
        #endregion

        #region 获取企业考核分
        public string GetCorpAssessInfo(string corpUserGuid, int bgrade, int bFlag, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return JsonConvert.SerializeObject(enterpriseBll.GetCorpAssessInfo(corpUserGuid, bgrade, bFlag));
        }
        #endregion

        #region 外网企业面板统计
        public string GetCorpPanelInfo(string corpPanel, string areaCode)
        {
            StatisCorpPanel stacorp = JsonConvert.DeserializeObject<StatisCorpPanel>(corpPanel);
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return JsonConvert.SerializeObject(enterpriseBll.GetCorpPanelInfo(stacorp));
        }
        #endregion

        #region 外网企业列表
        public string GetPortalCorpList(
   string queryCondition,
   int pageSize,
   int pageNum,
   string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            IList<DTO.QueryPortalCompanyInfoCondition> corpQuelityList = JsonConvert.DeserializeObject<IList<DTO.QueryPortalCompanyInfoCondition>>(queryCondition);
            IList<DTO.CompanyInfo> result = enterpriseBll.GetPortalCorpList(corpQuelityList, pageSize, pageNum, areaCode);
            return JsonConvert.SerializeObject(result);
        }

        public int GetPortalCorpCount(string queryCondition, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            IList<DTO.QueryPortalCompanyInfoCondition> corpQueryList = JsonConvert.DeserializeObject<IList<DTO.QueryPortalCompanyInfoCondition>>(queryCondition);
            int cnt = enterpriseBll.GetPortalCorpCount(corpQueryList, areaCode);
            return cnt;
        }
        #endregion

        #region 判断企业编辑状态
        public string CheckCorpEditStatus(string corpUserGuid, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return JsonConvert.SerializeObject(enterpriseBll.CheckCorpEditStatus(corpUserGuid, areaCode));
        }

        /// <summary>
        /// 判断企业安全生产许可证编辑状态
        /// </summary>
        /// <param name="corpUserGuid"></param>
        /// <param name="areaCode"></param>
        /// <returns></returns>
        public string CheckSecurityEditStatus(string corpUserGuid, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return JsonConvert.SerializeObject(enterpriseBll.CheckSecurityEditStatus(corpUserGuid, areaCode));
        }
        #endregion

        #region 获取企业考核列表
        public string GetItemBikedList(int pageSize, int pageNum, string condition, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            List<QueryCompanyInfoCondition> queryCondition = JsonConvert.DeserializeObject<List<QueryCompanyInfoCondition>>(condition);
            return JsonConvert.SerializeObject(enterpriseBll.GetItemBikedList(pageSize, pageNum, queryCondition, areaCode));
        }

        public int GetItemBikedCount(string condition, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            List<QueryCompanyInfoCondition> queryCondition = JsonConvert.DeserializeObject<List<QueryCompanyInfoCondition>>(condition);
            return enterpriseBll.GetItemBikedCount(queryCondition, areaCode);
        }

        public string GetEmpExpertList(int pageSize, int pageNum, string condition, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            List<QueryEmpExpertCondition> queryCondition = JsonConvert.DeserializeObject<List<QueryEmpExpertCondition>>(condition);
            return JsonConvert.SerializeObject(enterpriseBll.GetEmpExpertList(pageSize, pageNum, queryCondition, areaCode));
        }

        public int GetEmpExpertCount(string condition, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            List<QueryEmpExpertCondition> queryCondition = JsonConvert.DeserializeObject<List<QueryEmpExpertCondition>>(condition);
            return enterpriseBll.GetEmpExpertCount(queryCondition, areaCode);
        }
        #endregion

        #region 青岛招标代理系统首页企业、人员信息统计
        public string CorpStatis(string isNative, int roleid, int corpkindid, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return JsonConvert.SerializeObject(enterpriseBll.CorpStatis(isNative, roleid, corpkindid, areaCode));
        }

        public string GetCorpList(string queryCondition, out int count, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return JsonConvert.SerializeObject(enterpriseBll.GetCorpList(queryCondition, out count, areaCode));
        }

        public string GetZBDLCompanyInfo(string queryCondition, int pageSize, int pageNum, string areaCondition)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCondition);
            return JsonConvert.SerializeObject(enterpriseBll.GetZBDLCompanyInfo(JsonConvert.DeserializeObject<QueryCompanyInfoConditionZBDL>(queryCondition), pageSize, pageNum, areaCondition));
        }
        #endregion

        #region 通知管理
        public string GetNoticeList(out int count, int pageSize, int pageNum, string condition, string areaCondition)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCondition);
            List<QueryNoticeInfoCondition> querycondition = JsonConvert.DeserializeObject<List<QueryNoticeInfoCondition>>(condition);
            return JsonConvert.SerializeObject(enterpriseBll.GetNoticeList(out count, pageSize, pageNum, querycondition, areaCondition));
        }
        public string GetNotice(string guid, string areaCondition)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCondition);
            return JsonConvert.SerializeObject(enterpriseBll.GetNotice(guid));
        }
        public string SaveNoticeInfo(string noticeModel, string areaCondition)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCondition);
            return JsonConvert.SerializeObject(enterpriseBll.SaveNoticeInfo(JsonConvert.DeserializeObject<tb_Notice>(noticeModel)));
        }
        public string DeleteNotice(string keyGuid, string areaCondition)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCondition);
            return JsonConvert.SerializeObject(enterpriseBll.DeleteNotice(keyGuid));
        }
        #endregion

        public string GetCorBzjList(out int count, int pageIndex, int pageSize, string condition, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            List<DTO.CorpBzjInfo> list = enterpriseBll.GetCorBzjList(out count, pageIndex, pageSize, condition, areaCode);
            return JsonConvert.SerializeObject(list);
        }

        public string GetCorBzjGroupList(out int count, int pageIndex, int pageSize, string condition, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            List<string> list = enterpriseBll.GetCorBzjGroupList(out count, pageIndex, pageSize, condition, areaCode);
            return JsonConvert.SerializeObject(list);
        }

        public string GetItemBikedByCorp(out int count, int pageIndex, int pageSize, string userguid, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            List<h_ItemBiked> list = enterpriseBll.GetItemBikedByCorp(out count, pageIndex, pageSize, userguid);
            return JsonConvert.SerializeObject(list);
        }

        #region 获取企业在所有市场的状态
        public string GetCorpFlowStatus(string corpUserGuid, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return JsonConvert.SerializeObject(enterpriseBll.GetCorpFlowStatus(corpUserGuid, areaCode));
        }
        #endregion

        #region 公文新闻
        public string GetNewsList(out int count, int pageNum, int pageSize, string condition, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            List<QueryNewsInfoCondition> querycondition = JsonConvert.DeserializeObject<List<QueryNewsInfoCondition>>(condition);
            return JsonConvert.SerializeObject(enterpriseBll.GetNewsList(out count, pageNum, pageSize, querycondition, areaCode));
        }

        public string GetNewsInfo(int id, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return JsonConvert.SerializeObject(enterpriseBll.GetNewsInfo(id));
        }

        public string SaveNewsInfo(string newsModel, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return JsonConvert.SerializeObject(enterpriseBll.SaveNewsInfo(JsonConvert.DeserializeObject<b_NewsTable>(newsModel)));
        }

        public string DeleteNews(int id, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return JsonConvert.SerializeObject(enterpriseBll.DeleteNews(id));
        }
        #endregion

        #region 企业注册审核(烟台)
        public string GetCorpRegListYT(out int count, int pageNum, int pageSize, string condition, string areaCode, string flowClassId, string roleId)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            List<DTO.QueryCompanyInfoCondition> corpQueryList = JsonConvert.DeserializeObject<List<DTO.QueryCompanyInfoCondition>>(condition);
            List<DTO.CompanyInfo> result = enterpriseBll.GetCorpRegListYT(out count, pageNum, pageSize, corpQueryList, areaCode, flowClassId, roleId);
            return JsonConvert.SerializeObject(result);
        }
        public string CorpRegAudit(string corpUserGuid, string areaCode, string log, string flowCode, string description, bool isFinal, string classId)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            User_Log logModel = JsonConvert.DeserializeObject<User_Log>(log);
            RN.ERP.DTO.OperationResult result = enterpriseBll.CorpRegAudit(corpUserGuid, areaCode, logModel, flowCode, description, isFinal, classId);
            return JsonConvert.SerializeObject(result);
        }
        public string GetManagerRegListYT(out int count, int pageNum, int pageSize, string condition, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            List<DTO.QueryCompanyInfoCondition> corpQueryList = JsonConvert.DeserializeObject<List<DTO.QueryCompanyInfoCondition>>(condition);
            List<DTO.CompanyInfo> result = enterpriseBll.GetManagerRegListYT(out count, pageNum, pageSize, corpQueryList, areaCode);
            return JsonConvert.SerializeObject(result);
        }

        public string ManagerRegAudit(string userGuid, string areaCode, string log, string flowCode, string description, bool isFinal)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            User_Log logModel = JsonConvert.DeserializeObject<User_Log>(log);
            RN.ERP.DTO.OperationResult result = enterpriseBll.ManagerRegAudit(userGuid, areaCode, logModel, flowCode, description, isFinal);
            return JsonConvert.SerializeObject(result);
        }
        #endregion

        /// <summary>
        /// 企业锁定解锁
        /// </summary>
        /// <param name="corpUserGuid"></param>
        /// <param name="bCanBid"></param>
        /// <param name="type">0解锁，1锁定</param>
        /// <param name="areaCode"></param>
        /// <returns></returns>
        public string SetCorpbCanBid(string corpUserGuid, string bCanBid, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return JsonConvert.SerializeObject(enterpriseBll.SetCorpbCanBid(corpUserGuid, bCanBid, areaCode));

        }

        public void GenerateFlowCodebyAppId(string userGuid, int appID, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            enterpriseBll.GenerateFlowCodebyAppId(userGuid, appID, areaCode);
        }

        #region 咨询互动(烟台门户)
        public void AddConsultation(string submitInfo, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            zb_Consultation consultation = JsonConvert.DeserializeObject<zb_Consultation>(submitInfo);
            enterpriseBll.AddConsultation(consultation);
        }

        public string GetConsultationUser(string roleValue, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return JsonConvert.SerializeObject(enterpriseBll.GetConsultationUser(roleValue, areaCode));
        }

        public string GetPortalQuestionList(string isAnswer, string type, string userGuid, string role, int pageSize, int pageIndex, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return JsonConvert.SerializeObject(enterpriseBll.GetPortalQuestionList(isAnswer, type, userGuid, role, pageSize, pageIndex, areaCode));
        }

        public int GetPortalQuestionCount(string isAnswer, string type, string userGuid, string role, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return enterpriseBll.GetPortalQuestionCount(isAnswer, type, userGuid, role, areaCode);
        }


        public string GetPortalQuestion(string id, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return JsonConvert.SerializeObject(enterpriseBll.GetPortalQuestion(id, areaCode));
        }

        public string GetPortalAnswerList(string id, int pageSize, int pageIndex, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return JsonConvert.SerializeObject(enterpriseBll.GetPortalAnswerList(id, pageSize, pageIndex, areaCode));
        }

        public int GetPortalAnswerCount(string id, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return enterpriseBll.GetPortalAnswerCount(id, areaCode);
        }

        public string GetQuestionUser(string userGuid, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return enterpriseBll.GetQuestionUser(userGuid, areaCode);
        }

        public void AddConsultationAnswer(string submitInfo, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            zb_Consultation_Answer consultation = JsonConvert.DeserializeObject<zb_Consultation_Answer>(submitInfo);
            enterpriseBll.AddConsultationAnswer(consultation, areaCode);
        }

        public string GetUploadPicList(string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return JsonConvert.SerializeObject(enterpriseBll.GetUploadPicList(areaCode));
        }

        public string GetPersonByKeyGuid(string keyGuid, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return JsonConvert.SerializeObject(enterpriseBll.GetPersonByKeyGuid(keyGuid,areaCode));
        }
        #endregion


        /// <summary>
        /// 获取审核动态效果
        /// </summary>
        /// <param name="classId"></param>
        /// <param name="areaCode"></param>
        /// <param name="flowCode"></param>
        /// <returns></returns>
        public string GetProgressNodes(string classId, string areaCode, string flowCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return JsonConvert.SerializeObject(enterpriseBll.GetProgressNodes(classId, areaCode, flowCode));
        }



        #region 考核获取企业信息 2014-5-14 毛凯
        public string GetCompanyBusinessInfoKH(string corpUserGuid, string snapGuid, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return JsonConvert.SerializeObject(enterpriseBll.GetCompanyBusinessInfoKH(corpUserGuid, snapGuid, areaCode));
        }
        #endregion

        #region 考核企业附属信息 编辑 2014-5-15 毛凯
        public string CompanyAttchInfoKHEdit(
            string corpUserGuid,
            string capitalBusinessKH,
            string projectAchieveMentKH,
            string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return JsonConvert.SerializeObject(enterpriseBll.CompanyAttchInfoKHEdit(
                corpUserGuid,
                capitalBusinessKH,
                projectAchieveMentKH,
                areaCode));
        }
        #endregion

        #region  查询企业资质
        public string GetCorpLists(string queryCondition, int pageIndex, int pageSize, out int count, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return JsonConvert.SerializeObject(enterpriseBll.GetCorpLists(JsonConvert.DeserializeObject<IList<QueryCompanyInfoCondition>>(queryCondition), pageIndex, pageSize, out count, areaCode));
        }
        #endregion

        public string IsUrban(string userGuid,string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return JsonConvert.SerializeObject(enterpriseBll.IsUrban(userGuid));
        }

        #region 企业年检

             /// <summary>
        /// 企业自有或租赁的主要机械设备列表查询
        /// </summary>       
        public string GetCorpMachineInfoList(int pageIndex, int pageSize, out int count, Guid corpGuid, bool? isOwn, string areaCode)
        {            
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return JsonConvert.SerializeObject(enterpriseBll.GetCorpMachineInfoList(pageIndex,  pageSize, out  count,  corpGuid,  isOwn,  areaCode));          
         
        }

        /// <summary>
        /// 企业自有或租赁的主要机械设备查询
        /// </summary>  
        public string GetCorpMachineInfoByID(Guid corpGuid, int id, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return JsonConvert.SerializeObject(enterpriseBll.GetCorpMachineInfoByID(corpGuid,id,areaCode));
        }

        /// <summary>
        /// 添加企业自有或租赁的主要机械设备
        /// </summary>       
        public  bool AddCorpMachineInfo(DTO.tb_corp_MachineInfo model, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return enterpriseBll.AddCorpMachineInfo(model, areaCode);     
        }

        /// <summary>
        /// 逻辑删除企业自有或租赁的主要机械设备列表查询
        /// </summary>       
        public  bool DelCorpMachineInfo(int id, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return enterpriseBll.DelCorpMachineInfo(id, areaCode);     
        }
        /// <summary>
        /// 修改企业自有或租赁的主要机械设备
        /// </summary>       
        public  bool UpdateCorpMachineInfo(DTO.tb_corp_MachineInfo model, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return enterpriseBll.UpdateCorpMachineInfo(model, areaCode);     
        }


        /// <summary>
        /// 企业企业财务经营状况列表查询
        /// </summary>       
        public string GetCorpFinancialInfoList(string corpName, int pageIndex, int pageSize, Guid corpGuid, int? currentYear, string areaCode, out int count)
        {
            string currentArea = string.IsNullOrEmpty(areaCode) ? "14" : areaCode.Length > 2 ? areaCode.Substring(0, 2) : areaCode;
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, currentArea);
            return JsonConvert.SerializeObject(enterpriseBll.GetCorpFinancialInfoList(corpName,pageIndex, pageSize, corpGuid, currentYear, areaCode,out count));          
        }

        /// <summary>
        /// 企业企业财务经营状况查询
        /// </summary> 
        public string GetCorpFinancialInfoByID(Guid corpGuid, int id, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return JsonConvert.SerializeObject(enterpriseBll.GetCorpFinancialInfoByID(corpGuid,id,areaCode));
        }

        /// <summary>
        /// 企业财务上一年财务经营状况查询
        /// </summary>
        /// <param name="corpGuid"></param>
        /// <param name="currentYear"></param>
        /// <param name="areaCode"></param>
        /// <returns></returns>
        public string GetCorpFinancialInfoByYear(Guid corpGuid, int? currentYear, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return JsonConvert.SerializeObject(enterpriseBll.GetCorpFinancialInfoByYear(corpGuid, currentYear, areaCode));
        }

        /// <summary>
        /// 添加企业财务经营状况
        /// </summary>       
        public  bool AddCorpFinancialInfo(DTO.tb_corp_FinancialInfo model, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return enterpriseBll.AddCorpFinancialInfo(model, areaCode);          
         
        }
        
        /// <summary>
        /// 逻辑企业财务经营状况
        /// </summary>       
        public  bool DelCorpFinancialInfo(int id, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return enterpriseBll.DelCorpFinancialInfo(id, areaCode);        
        }
        /// <summary>
        /// 修改企业财务经营状况
        /// </summary>       
        public  bool UpdateCorpFinancialInfo(DTO.tb_corp_FinancialInfo model, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            return enterpriseBll.UpdateCorpFinancialInfo(model, areaCode);     
        }
        /// <summary>
        /// 修改企业类型
        /// </summary>
        /// <param name="corpUserGuid"></param>
        /// <param name="roleid"></param>
        /// <param name="classid"></param>
        /// <param name="areaCode"></param>
        /// <returns></returns>
        public string UpdateCorpType(string corpUserGuid, int roleid, int classid, string areaCode, string OptManGuid, string OptManName)
        {	
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, System.Configuration.ConfigurationManager.AppSettings["area"]);
            return JsonConvert.SerializeObject(enterpriseBll.UpdateCorpType(corpUserGuid,  roleid,  classid,  areaCode,  OptManGuid,  OptManName));
        }
        /// <summary>
        /// 修改企业管理地
        /// </summary>
        /// <param name="corpUserGuid"></param>
        /// <param name="areaCode"></param>
        /// <param name="OptManGuid"></param>
        /// <param name="OptManName"></param>
        /// <returns></returns>
        public string UpdateCorpManageZone(string corpUserGuid, string areaCode, string OptManGuid, string OptManName)
        {           
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise,                          System.Configuration.ConfigurationManager.AppSettings["area"]);
            return JsonConvert.SerializeObject(enterpriseBll.UpdateCorpManageZone( corpUserGuid,  areaCode,  OptManGuid,  OptManName));
        }
        #endregion

        #region 企业注册审核(聊城)
        public string GetCorpRegListLC(out int count, int pageNum, int pageSize, string condition, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            List<DTO.QueryCompanyInfoCondition> corpQueryList = JsonConvert.DeserializeObject<List<DTO.QueryCompanyInfoCondition>>(condition);
            List<DTO.CompanyInfo> result = enterpriseBll.GetCorpRegListLC(out count, pageNum, pageSize, corpQueryList, areaCode);
            return JsonConvert.SerializeObject(result);
        }
        /// <summary>
        /// 获取聊城企业信息
        /// </summary>
        /// <param name="count"></param>
        /// <param name="pageNum"></param>
        /// <param name="pageSize"></param>
        /// <param name="corpName"></param>
        /// <param name="classid"></param>
        /// <param name="areaCode"></param>
        /// <returns></returns>
        public string GetCorpListLC(out int count, int pageNum, int pageSize, string corpName,int classid, string areaCode)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, System.Configuration.ConfigurationManager.AppSettings["area"]);

            List<DTO.CompanyInfo> result = enterpriseBll.GetCorpListLC(out count, pageNum, pageSize, corpName, classid, areaCode);
            return JsonConvert.SerializeObject(result);
        }

        #endregion

        public string GetCorpListByGroupID(
        string queryCondition,
        int pageSize,
        int pageNum,
        string areaCode,
        int groupId,
        out int cnt)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            IList<DTO.QueryCompanyInfoCondition> corpQuelityList = JsonConvert.DeserializeObject<IList<DTO.QueryCompanyInfoCondition>>(queryCondition);
            IList<DTO.CompanyInfo> result = enterpriseBll.GetCorpListByGroupID(corpQuelityList, pageSize, pageNum, areaCode,groupId,out cnt);
            return JsonConvert.SerializeObject(result);
        }

        public string GetCorpPostInfoList(
        string queryCondition,
        int pageSize,
        int pageNum,
        string areaCode,
        int groupId,
        out int cnt)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            IList<DTO.QueryCompanyInfoCondition> corpQuelityList = JsonConvert.DeserializeObject<IList<DTO.QueryCompanyInfoCondition>>(queryCondition);
            IList<DTO.CompanyInfo> result = enterpriseBll.GetCorpPostInfoList(corpQuelityList, pageSize, pageNum, areaCode, groupId, out cnt);
            return JsonConvert.SerializeObject(result);
        }

        #region 企业组织机构代码修改(聊城)
        /// <summary>
        /// 企业获取组织机构代码信息
        /// </summary>
        /// <param name="corpUserGuid"></param>
        /// <param name="areaCode"></param>
        /// <param name="codeType"></param>
        /// <param name="appID"></param>
        /// <returns></returns>
        public string GetCorpOrgByCorpUserGuid(string corpUserGuid, string areaCode, int codeType, int appID)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            RN.ERP.DTO.Tb_FlowCode result = enterpriseBll.GetCorpOrgByCorpUserGuid(corpUserGuid, areaCode, codeType, appID);
            return JsonConvert.SerializeObject(result);
        }
        /// <summary>
        /// 企业上报申请修改组织机构代码
        /// </summary>
        /// <param name="corpUserGuid"></param>
        /// <param name="areaCode"></param>
        /// <param name="codeType"></param>
        /// <param name="appID"></param>
        /// <param name="optType"></param>
        /// <returns></returns>
        public string CorpOrgPost(string orgCode, string corpUserGuid, string orgGuid, string areaCode, int codeType, int appID, int optType)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            RN.ERP.DTO.OperationResult result = enterpriseBll.CorpOrgPost(orgCode, corpUserGuid, orgGuid, areaCode, codeType, appID, optType);
            return JsonConvert.SerializeObject(result);
        }
        /// <summary>
        /// 主管获取组织机构代码列表
        /// </summary>
        /// <param name="queryCondition"></param>
        /// <param name="pageSize"></param>
        /// <param name="pageNum"></param>
        /// <param name="areaCode"></param>
        /// <param name="codeType"></param>
        /// <param name="appID"></param>
        /// <param name="cnt"></param>
        /// <returns></returns>
        public string GetCorpOrgList(
            string curFlowcode,
            string corpName,
            int pageSize,
            int pageNum,
            string areaCode,
            int codeType,
            int appID,
            out int cnt)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            IList<DTO.Tb_FlowCode> result = enterpriseBll.GetCorpOrgList(curFlowcode, corpName, pageSize, pageNum, areaCode, codeType, appID, out cnt);
            return JsonConvert.SerializeObject(result);
        }

        /// <summary>
        /// 主管审核组织机构代码变更
        /// </summary>
        /// <param name="corpUserGuid"></param>
        /// <param name="areaCode"></param>
        /// <param name="codeType"></param>
        /// <param name="appID"></param>
        /// <param name="optType"></param>
        /// <returns></returns>
        public string CorpOrgAudit(List<string> corpUserGuid, string roleID, string areaCode, int codeType, int appID, int optType)
        {
            BaseEnterpriseBLL enterpriseBll = (BaseEnterpriseBLL)BllFactory.CreateBll(BllType.Enterprise, areaCode);
            RN.ERP.DTO.OperationResult result = enterpriseBll.CorpOrgAudit(corpUserGuid, roleID, areaCode, codeType, appID, optType);
            return JsonConvert.SerializeObject(result);
        }
        #endregion
    }
}
